<!DOCTYPE html>
<html class="x-admin-sm">
{include file="common/static" /}
    <body>
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form">
                  <div class="layui-form-item">
                      <label for="username" class="layui-form-label">
                          <span class="x-red">*</span>随客姓名
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="guest_name"  required="" lay-verify="required"
                          autocomplete="off" class="layui-input">
                      </div>
                  </div>
                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>证件号码
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="credentials"  required="" lay-verify="required"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <input type="hidden" value="{$id}" id="ids">
                  <div class="layui-form-item">
                      <label for="L_repass" class="layui-form-label">
                      </label>
                      <button  class="layui-btn" type="button" onclick="adds()">
                          增加
                      </button>
                  </div>
              </form>
            </div>
        </div>

    </body>
<script>
    function adds(){
        $.ajax({
            type:"post",
            url: "{:url('home/index/addpeers')}",
            data: {
                id:$('#ids').val(),
                guest_name:$('#guest_name').val(),
                credentials:$('#credentials').val(),
                status:2
            },
            success: function(data){
                console.log(data);
                toastr.error(data.msg);
                if(data.code == 100){
                    setTimeout(function () {
                        layer.closeAll();
                        parent.location.reload();
                    },1500);
                }
            }});
    }
</script>

</html>
